﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace FluentAPI_Test.Migrations
{
    /// <inheritdoc />
    public partial class ModifySomething : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "Author",
                table: "T_Books2",
                newName: "AuthorName");

            migrationBuilder.AlterColumn<string>(
                name: "AuthorName",
                table: "T_Books2",
                type: "nvarchar(40)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AddColumn<double>(
                name: "Price",
                table: "T_Books2",
                type: "float",
                nullable: false,
                defaultValue: 88.900000000000006);

            migrationBuilder.CreateIndex(
                name: "IX_T_Books2_AuthorName",
                table: "T_Books2",
                column: "AuthorName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_T_Books2_Price",
                table: "T_Books2",
                column: "Price");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_T_Books2_AuthorName",
                table: "T_Books2");

            migrationBuilder.DropIndex(
                name: "IX_T_Books2_Price",
                table: "T_Books2");

            migrationBuilder.DropColumn(
                name: "Price",
                table: "T_Books2");

            migrationBuilder.RenameColumn(
                name: "AuthorName",
                table: "T_Books2",
                newName: "Author");

            migrationBuilder.AlterColumn<string>(
                name: "Author",
                table: "T_Books2",
                type: "nvarchar(max)",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(40)");
        }
    }
}
